package upgrade

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"github.com/sagoo-cloud/sagooiot/api/v1/common"
	"github.com/sagoo-cloud/sagooiot/internal/model"
)

// GetDevOtaFirewareListReq 获取数据列表
type GetDevOtaFirewareListReq struct {
	g.Meta `path:"/dev_ota_fireware/list" method:"get" summary:"获取升级包详情列表" tags:"升级"`
	common.PaginationReq
}
type GetDevOtaFirewareListRes struct {
	Data []GetDevOtaFirewareByIdRes `json:"fireware"`
	common.PaginationRes
}

// GetDevOtaFirewareByIdReq 获取指定ID的数据
type GetDevOtaFirewareByIdReq struct {
	g.Meta `path:"/dev_ota_fireware/get" method:"get" summary:"获取升级包" tags:"升级"`
	Id     int `json:"id"        description:"id" v:"required#id不能为空"`
}
type GetDevOtaFirewareByIdRes struct {
	WaitVersion  string `json:"waitVersion"          description:"待升级版本号"`
	Url          string `json:"url"          description:"升级包路径"`
	Describe     string `json:"describe"          description:"升级包描述"`
	Info         string `json:"info"          description:"推送给设备的描述"`
	Typo         string `json:"typo"          description:"1整包，2差分"`
	UpdatedAt    string `json:"updatedAt"          description:"修改时间"`
	Name         string `json:"name"          description:"升级包名称"`
	ProductId    string `json:"productId"          description:"所属产品"`
	Module       string `json:"module"          description:"升级包所属模块"`
	Version      string `json:"version"          description:"升级包版本号"`
	AfterVersion string `json:"afterVersion"          description:"升级后版本好"`
	Are          string `json:"are"          description:"签名算法"`
	Check        string `json:"check"          description:"1需要，2不需要"`
	Checkres     int    `json:"checkres"  description:"升级包验证0未验证，1已验证"`
	Id           string `json:"id"          description:""`
	ProductName  string `json:"productName" description:"所属产品"`
	ModuleNmae   string `json:"moduleName"  description:"模块名称"`
	Size         int    `json:"size" description:"升级包大小" `
	Sign         string `json:"sign" description:"升级包签名"`
	CreatedAt    string `json:"createdAt"          description:"添加时间"`
	CreatedBy    string `json:"createdBy"          description:"添加人"`
}

// AddDevOtaFirewareReq 添加数据
type AddDevOtaFirewareReq struct {
	g.Meta `path:"/dev_ota_fireware/add" method:"post" summary:"添加升级包" tags:"升级"`
	model.DevOtaFirewareAddInput
}
type AddDevOtaFirewareRes struct{}

// EditDevOtaFirewareReq 编辑数据api
type EditDevOtaFirewareReq struct {
	g.Meta `path:"/dev_ota_fireware/edit" method:"put" summary:"编辑升级包" tags:"升级"`
	model.DevOtaFirewareAddInput
	Id int `json:"id" dc:"升级包ID" v:"required#升级包ID不能为空"`
}
type EditDevOtaFirewareRes struct{}

// DeleteDevOtaFirewareReq 删除数据
type DeleteDevOtaFirewareReq struct {
	g.Meta `path:"/dev_ota_fireware/delete" method:"delete" summary:"删除升级包" tags:"升级"`
	Ids    []int `json:"ids"        description:"ids" v:"required#ids不能为空"`
}
type DeleteDevOtaFirewareRes struct{}

// UploadReq .
type UploadReq struct {
	g.Meta `path:"/dev_ota_fireware/upload" tags:"升级" method:"POST" summary:"固件上传"`
	Files  ghttp.UploadFiles `json:"file" type:"file" dc:"选择上传文件"`
}

type UploadRes struct {
	Url string `json:"url"`
}
